package com.example.demo.enums;


public enum BookStatus {
    AVAILABLE(1, "可借阅"),
    NOT_AVAILABLE(2, "不可借阅"),
    DELETED(0, "已删除"),
    ;


    private Integer code;
    private String desc;

    BookStatus() {
    }

    BookStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static BookStatus getStatusByCode(Integer code){
        switch(code){
            default:
            case 0: return DELETED;
            case 1: return AVAILABLE;
            case 2: return NOT_AVAILABLE;
        }
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
